#ifndef _Shape_H_
#define _Shape_H_

class Shape{
	public:
		virtual float area()=0;
};

class triangle: public Shape
{
	private:
		float s, h;
	
	public:
		triangle(): s(0), h(0){}
		triangle(const float ss, const float hh): s(ss), h(hh){}
		triangle(const triangle& pt): s(pt.s), h(pt.h){}

		float area()
		{
			return s * h / 2;
		}
};

class rectangle: public Shape
{
	private:
		float l, s;

	public:
		rectangle(): l(0), s(0){}
		rectangle(const float ll, const float ss): l(ll), s(ss){}
		rectangle(const rectangle& pt): l(pt.l), s(pt.s){}

		virtual float area()
		{
			return l * s;
		}
};

float total(Shape *s[], int n)
{
	float sum = 0.0;
	for(int i=0; i<n; ++i)
		sum+=(s[i]->area());
	return sum;
}

#endif
